{include file="common/header"/}
<body class="bg-light">
	<div class="container">
		<div class="d-flex">
			<div class="col-md-8">
			{switch name="Think.get.type"}
		    {case value="1"}
			    {notempty name="$at_data_list['text']"}
			    {foreach $at_data_list['text'] as $text}
			    <div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<a href="/index/person?user_id={$text.user.id}" class="text-dark a-notdecoration">
								<img src="__AVATOR__{$text.user.avator_path}" class="img-circle img-md">
							</a>
							<div class="media-body ml-2">
								<div class="float-right">
									<span class="badge badge-info ml-3">内容</span>
									<a href="/index/notice/setRead?sender={$text.id}&type=1" class="read badge badge-primary ml-3">标为已读</a>
								</div>
								<p class="my-1"><a href="/index/person?user_id={$text.user.id}" class="text-dark a-notdecoration"><strong>{$text.user.fullname}</strong></a></p>
								<p>{$text.create_time}</p>
							</div>
						</div>
						<div>
						{$text.content}
						</div>
						<hr class="my-1">
						<div class="row mt-3">
							{in name="$text.id" value="$like_list"}
							<div class="col-md text-center"><a id="if_like_{$text.id}" href="#" class="text-dark a-notdecoration if_like"><i class="fa fa-thumbs-up"></i>&nbsp;{$text.like_num}</a></div>
							{else/}
							<div class="col-md text-center"><a id="if_like_{$text.id}" href="#" class="text-dark a-notdecoration if_like"><i class="fa fa-thumbs-o-up"></i>&nbsp;{$text.like_num}</a></div>
							{/in}
	  						<div class="col-md text-center"><a href="/index/text?text_id={$text.id}" class="text-dark a-notdecoration"><i class="fa fa-comment"></i>&nbsp;{$text.reply_num}</a></div>
	  					</div>
					</div>
				</div>
				{/foreach}
				{/notempty}
				{notempty name="$at_data_list['reply']"}
				{foreach $at_data_list['reply'] as $reply}
			    <div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<img src="__AVATOR__{$reply.user.avator_path}" class="img-circle img-md">
							<div class="media-body ml-2">
								<div class="float-right">
									<span class="badge badge-info ml-3">回复</span>
									<a href="/index/notice/setRead?sender={$reply.id}&type=2" class="read badge badge-primary ml-3">标为已读</a>
								</div>
								<p class="my-1"><strong>{$reply.user.fullname}</strong></p>
								<p>{$reply.create_time}</p>									
							</div>
						</div>
						<div>
							<a href="/index/text?text_id={$reply.text.id}" class="text-dark a-notdecoration">
							{$reply.content}
							</a>
							<div class="border bg-light p-2 mt-2 h-25">
							{$reply.text.content}
							</div>
						</div>
					</div>
				</div>
				{/foreach}
				{/notempty}
				{notempty name="$at_data_list['topic_reply']"}
				{foreach $at_data_list['topic_reply'] as $topic_reply}
			    <div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<img src="__AVATOR__{$topic_reply.user.avator_path}" class="img-circle img-md">
							<div class="media-body ml-2">
								<div class="float-right">
									<span class="badge badge-info ml-3">回复</span>
									<a href="/index/notice/setRead?sender={$topic_reply.id}&type=0" class="read badge badge-primary ml-3">标为已读</a>
								</div>
								<p class="my-1"><strong>{$topic_reply.user.fullname}</strong></p>
								<p>{$topic_reply.create_time}</p>									
							</div>
						</div>
						<div>
							<a href="/index/topic?topic_id={$topic_reply.topic.id}" class="text-dark a-notdecoration">
							{$topic_reply.content}
							</a>
							<div class="border bg-light p-2 mt-2 h-25">
							{$topic_reply.topic.title}
							</div>
						</div>
					</div>
				</div>
				{/foreach}
				{/notempty}
		    {/case}
		    {case value="2"}
		    	{notempty name="$reply_data_list['text']"}
		    	{foreach $reply_data_list['text'] as $reply}
		    	<div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<img src="__AVATOR__{$reply.user.avator_path}" class="img-circle img-md">
							<div class="media-body ml-2">
								<div class="float-right">
									<span class="badge badge-info ml-3">回复</span>
									<a href="/index/notice/setRead?sender={$reply.id}&type=3" class="read badge badge-primary ml-3">标为已读</a>
								</div>
								<p class="my-1"><strong>{$reply.user.fullname}</strong></p>
								<p>{$reply.create_time}</p>									
							</div>
						</div>
						<div>
							<a href="/index/text?text_id={$reply.tid}" class="text-dark a-notdecoration">
							{$reply.content}
							</a>
							<div class="border bg-light p-2 mt-2 h-25">
							{$reply.text.content}
							</div>
						</div>
					</div>
				</div>
		    	{/foreach}
		    	{/notempty}
		    	{notempty name="$reply_data_list['topic']"}
		    	{foreach $reply_data_list['topic'] as $reply}
		    	<div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<img src="__AVATOR__{$reply.user.avator_path}" class="img-circle img-md">
							<div class="media-body ml-2">
								<div class="float-right">
									<span class="badge badge-info ml-3">回复</span>
									<a href="/index/notice/setRead?sender={$reply.id}&type=6" class="read badge badge-primary ml-3">标为已读</a>
								</div>
								<p class="my-1"><strong>{$reply.user.fullname}</strong></p>
								<p>{$reply.create_time}</p>									
							</div>
						</div>
						<div>
							<a href="/index/topic?topic_id={$reply.tid}" class="text-dark a-notdecoration">
							{$reply.content}
							</a>
							<div class="border bg-light p-2 mt-2 h-25">
							{$reply.topic.title}
							</div>
						</div>
					</div>
				</div>
		    	{/foreach}
		    	{/notempty}
		    {/case}
		    {case value="3"}
		    	{notempty name="$like_data_list"}
		    	{foreach $like_data_list as $like}
		    	<div class="card my-4">
					<div class="card-body" >
						<div class="media">
							<img src="__AVATOR__{$like.user.avator_path}" class="img-circle img-sm">
							<div class="media-body ml-2">
								<a href="/index/text?text_id={$like.tid}" class="text-dark a-notdecoration">
								<p class="my-1"><strong>{$like.user.fullname}</strong>&nbsp;赞了你，点击查看详情</p>
								</a>
							</div>
						</div>
					</div>
				</div>
				{/foreach}
		    	{/notempty}
		    {/case}
		    {default /}
			{/switch}
			</div>
			<div class="col-md-4">
				<div class="card my-4">
					<div class="card-body">
						<div class="list-group list-group-flush">
							<a href="/index/notice?type=1" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">&bull;&nbsp;@  我的
							<span class="badge badge-primary badge-pill">{$show_num['at']}</span>
							</a>
							<a href="/index/notice?type=2" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">&bull;&nbsp;回复我的
							<span class="badge badge-primary badge-pill">{$show_num['reply']}</span>
							</a>
							<a href="/index/notice?type=3" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">&bull;&nbsp;收到的赞
							<span class="badge badge-primary badge-pill">{$show_num['like']}</span>
							</a>
							<a href="/index/notice?type=4" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">&bull;&nbsp;系统通知
							<span class="badge badge-primary badge-pill">{$show_num['system']}</span>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">
	$(function(){
		$('.if_like').click(function(event) {
			event.preventDefault();
			var if_like_icon = $(this).children('i');
			var if_like = null;
			if (if_like_icon.hasClass('fa-thumbs-o-up')) {
				if_like_icon.removeClass('fa-thumbs-o-up');
				if_like_icon.addClass('fa-thumbs-up');
				if_like = 1;
			}
			else {
				if_like_icon.removeClass('fa-thumbs-up');
				if_like_icon.addClass('fa-thumbs-o-up');
				if_like = 0;
			}

			var button_id = $(this).attr('id');
			var start = button_id.lastIndexOf('_');
			var text_id = button_id.substring(start + 1);

			if (if_like == 1) {
				$.post("/index/text/addLike", {
					'text_id': text_id
				},
				function(result) {
					if (result.status == 'success') {
						setTimeout(function(){
							location.reload();
						}, 10);
	      			}
				}, "json");
			}
			if (if_like == 0) {
				$.post("/index/text/deleteLike", {
					'text_id': text_id
				},
				function(result) {
					if (result.status == 'success') {
						setTimeout(function(){
							location.reload();
						}, 10);
					}
				}, "json");
			}
		});
		$('.read').click(function(event) {
			event.preventDefault();
			$(this).removeClass('badge-primary');
			$(this).addClass('badge-secondary');
			$(this).html('已读');

			var url = $(this).attr('href');
			$.get(url, function(result) {
				if (result.status == 'error') {
					toastr.error(result.message);
				}
			});
		});
	})
</script>